<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view class="inputpwd">
			<input v-model="inputCode" placeholder="请输入解密秘钥"  />
		</view>
		<view @click="onLogin">确定</view>
		<view style="margin-top: 99px;" @click="testPage">测试页面</view>
	</view>
</template>

<script>
	import MD5 from '@/utils/crypto-js/md5.js'
	import {addPerson} from "@/API/sqlite/person.js"
 	export default {
		data() {
			return {
				title: '请输入解密秘钥，\n提示:不管正确与否都会进去的',
				inputCode: ""
			}
		},
		onLoad() {
		},
		methods: {
			onLogin:function(){
				if(this.inputCode.length < 3){
					plus.nativeUI.alert("密码输入不正确");
					return;
				}
				uni.setStorage({
					key: 'mysecuritykey',
					data: {
						userid: "wejf0011610970600061",
						inputcode: MD5("rota" + this.inputCode + "moxie").toString()
					}
				})
				uni.redirectTo({
					url: '../home/home'
				})
			},
			testPage: function(){
				// console.log("after md5 ===",MD5(MD5("rota" + this.inputCode + "moxie").toString()).toString());
				uni.setStorage({
					key: 'mysecuritykey',
					data: {
						userid: "wejf0011610970600061",
						inputcode: MD5("rota" + this.inputCode + "moxie").toString()
					}
				})
				console.log("inputCode====",this.inputCode)
				uni.navigateTo({
					url: '../test/test'
				});
			},
		}
	}
</script>

<style>
	.inputpwd{
		border: solid 1px #3F536E;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
